import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/main.css'
// 导入混入
import authMixin from '@/mixins/auth'
import resizeMixin from '@/mixins/resize'

// 导入指令
import authDirective from '@/directives/auth'
import lazyLoad from '@/directives/lazyLoad'
import safeHtml from '@/directives/safeHtml'

// 导入过滤器
import { formatDate } from '@/filters'

// 导入插件
import Toast from '@/plugins/toast'

import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
// 设置为 Vue 原型属性
Vue.prototype.$dayjs = dayjs
dayjs.locale('zh-cn') // 全局使用中文
// 使用混入
Vue.mixin(authMixin)
Vue.mixin(resizeMixin)

// 注册指令
Vue.directive('auth', authDirective)
Vue.directive('lazy', lazyLoad)
Vue.directive('safe-html', safeHtml)

// 注册过滤器
Vue.filter('formatDate', formatDate)

// 使用插件
Vue.use(ElementUI)
Vue.use(Toast, {
  duration: 5000
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')